package com.wms.modules.controller;

import com.ruoyi.common.core.domain.RR;
import com.ruoyi.common.core.mybatisplus.WhereCondition;
import com.ruoyi.common.core.web.controller.AbstractController;
import com.wms.modules.entitis.WarehouseMgmt;
import com.wms.modules.service.WarehouseMgmtService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: Z
 * @Date: 2024/6/23 16:12
 * @Description: 仓库管理
 */
@Api(value = "仓库管理", description = "仓库管理")
@RestController
@RequestMapping("/warehouse")
public class WarehouseMgmtController extends AbstractController {


    /**
     * 查询入驻厂家管理列表
     */
    @ApiOperation(value = "分页查询", notes = "分页查询")
    @GetMapping("/queryPage")
    public RR queryPage(@RequestBody WhereCondition<WarehouseMgmt> where)
    {
        return callData(()->ref(WarehouseMgmtService.class).queryPage(where));
    }

    @ApiOperation(value = "通过Id查询", notes = "通过Id查询")
    @GetMapping("/findById")
    public RR findById(@RequestParam("id")String id){
        return callData(()->ref(WarehouseMgmtService.class).findSnById(id));
    }


    @ApiOperation(value = "新增", notes = "新增")
    @PostMapping("/insert")
    public RR insert(@RequestBody WarehouseMgmt factoryMgmt){
        return callAuto(()->ref(WarehouseMgmtService.class).insert(factoryMgmt));
    }

    @ApiOperation(value = "修改", notes = "修改")
    @PostMapping("/updateById")
    public RR updateById(@RequestBody WarehouseMgmt factoryMgmt){
        return callData(()->ref(WarehouseMgmtService.class).updateById(factoryMgmt));
    }

    @ApiOperation(value = "批量删除", notes = "批量删除")
    @PostMapping("/deleteIds")
    public RR deleteByIds(String[] ids){
        return callAuto(()->ref(WarehouseMgmtService.class).deleteByIds(ids));
    }

    @ApiOperation(value = "删除", notes = "删除")
    @GetMapping("/deleteById")
    public RR deleteById(@RequestParam("id") String id){
        return callAuto(()->ref(WarehouseMgmtService.class).deleteById(id));
    }


}
